﻿using InParkRedemptionAPI.DataAccess;
using RapidSalesAdminPortalAPI.DataAccess;
using WebAPI.Controllers;
using WebAPI.DataAccess;

namespace WebAPI.Services
{
    public interface ISystemLogService
    {
        public void CreateSystemLog(FrIpSystemLog logInfo);
    }
    public class SystemLogService : ISystemLogService
    {
        private readonly RS_LogPortalContext _context;
        private readonly ILogger _logger;
        public SystemLogService(RS_LogPortalContext context, 
            ILogger<ISystemLogService> logger )
        {
            _context = context;
            _logger = logger;
        }
        /// <summary>
        /// record system log
        /// </summary>
        /// <param name="logInfo"></param>
        /// <returns></returns>
        public void CreateSystemLog(FrIpSystemLog logInfo)
        {
            logInfo.Id = Guid.NewGuid();
            var rst = this._context.FrIpSystemLogs.Add(logInfo);

            _ = this._context.SaveChanges();
        }
    }
}
